home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / doCreateCharacterArgList.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  3.5 KB  |  121 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  Oct 26, 1998
  22. //  Author:         mt
  23. //
  24. //    Procedure Name:
  25. //        doCreateCharacterArgList
  26. //
  27. //    Description:
  28. //        Create a new character
  29. //
  30. //    Input Arguments:
  31. //    $version: The version of this option box.  Used to know how to 
  32. //    interpret the $args array.
  33. //        "1" : $name
  34. //  
  35. //    $args
  36. //    Version 1
  37. //    [0]        $name :  name to give the new character
  38. //    Version 2
  39. //    [0]        $name :  name to give the new character
  40. //  [1]     $excludeTranslate : exclude translate attrs when creating char
  41. //  [2]     $excludeRotate : exclude rotate attrs when creating char
  42. //  [3]     $excludeScale : exclude scale attrs when creating char
  43. //  [4]     $excludeVis : exclude visibility attrs when creating char
  44. //  [5]     $excludeDynamic : exclude dynamic attrs when creating char
  45. //  [6]     $channelBox : create based on channel box selections
  46. //    Version 3
  47. //  [7]     $useHierarchy : use entire selected hierarchy
  48. //
  49. //    Return Value:
  50. //        None
  51. //
  52.  
  53. global proc doCreateCharacterArgList( string $version, string $args[] )
  54. {
  55.     string $name = $args[0];
  56.     int $versionNo = $version;
  57.     int $excludeTranslate = 0;
  58.     int $excludeRotate = 0;
  59.     int $excludeScale = 0;
  60.     int $excludeVisibility = 0;
  61.     int $excludeDynamic = 0;
  62.     int $useChannelBox = 0;
  63.     int $useHierarchy = 0;
  64.     if ($versionNo > 1) {
  65.         $excludeTranslate = $args[1];
  66.         $excludeRotate = $args[2];
  67.         $excludeScale = $args[3];
  68.         $excludeVisibility = $args[4];
  69.         $excludeDynamic = $args[5];
  70.         $useChannelBox = $args[6];
  71.     }
  72.     if ($versionNo > 2) {
  73.         $useHierarchy = $args[7];
  74.     }
  75.  
  76.     string $currentSelection[] = `ls -selection`;
  77.     if ($useHierarchy) {
  78.         string $sel;
  79.         $currentSelection = `ls -selection -dag -tr -ap`;
  80.         for ($sel in $currentSelection) {
  81.             if (nodeType($sel) != "ikEffector") {
  82.                 select -add $sel;
  83.             }
  84.         }
  85.     }
  86.  
  87.     if ($useChannelBox) {
  88.         string $attrs[] = `selectedChannelBoxPlugs`;
  89.         select -r $attrs;
  90.     }
  91.     
  92.     // Build the create character command
  93.     //
  94.     $cmd = ( "character -name \"" + $name + "\"");
  95.  
  96.     if ($excludeVisibility)
  97.         $cmd += " -excludeVisibility";
  98.     if ($excludeScale)
  99.         $cmd += " -excludeScale";
  100.     if ($excludeTranslate)
  101.         $cmd += " -excludeTranslate";
  102.     if ($excludeRotate)
  103.         $cmd += " -excludeRotate";
  104.     if ($excludeDynamic)
  105.         $cmd += " -excludeDynamic";
  106.     
  107.     // Create the new character
  108.     //
  109.     string $character = evalEcho( $cmd );
  110.  
  111.     // Set the new character to be the current character on the highlight list
  112.     //
  113.     setCurrentCharacters( { $character } );
  114.     
  115.     // Put back the previous selection.  We've put the character on
  116.     // the highlight list, which is what we want
  117.     //
  118.     select -r $currentSelection;
  119.     
  120. }
  121.